<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>冒泡排序</title>
	</head>
	<body>
		<script>
			var arr=[];
			while(true){
				var num=parseInt(prompt("请输入数组"));
				arr.push(num);
				var choice=prompt("是否继续输入,结束输入no");
				if(choice=='no'){
					break;
				}
			}
			function sort(arr){
				for(var i=1;i<arr.length;i++){
					for(var j=0;j<arr.length-i;j++){
						if(arr[j]>arr[j+1]){
							var temp=arr[j];
							arr[j]=arr[j+1];
							arr[j+1]=temp;
						}
					}
				}
				return arr;
			}
			console.log(sort(arr));
		</script>
	</body>
</html>
